# Contributor: Jacek Pruciak <alpine@juniorjpdj.pl>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jacek Pruciak <alpine@juniorjpdj.pl>
pkgname=zsh-theme-powerlevel10k
pkgver=1.16.1
pkgrel=0
pkgdesc="Theme for Zsh. It emphasizes speed, flexibility and out-of-the-box experience."
url="https://github.com/romkatv/powerlevel10k"
arch="noarch"
license="MIT"
depends="gitstatus-zsh-plugin zsh"
options="!check"  # no upstream tests
source="https://github.com/romkatv/powerlevel10k/archive/refs/tags/v$pkgver/$pkgname-$pkgver.tar.gz
	powerlevel10k.plugin.zsh
	"
builddir="$srcdir/powerlevel10k-$pkgver"

prepare() {
	default_prepare

	local req_ver act_ver
	req_ver=$(. gitstatus/build.info; echo "$gitstatus_version")
	act_ver=$(/usr/libexec/gitstatusd --version)

	if [ "$(apk version -t "$act_ver" "$req_ver")" = '<' ]; then
		warning "gitstatus aport is outdated, upgrade it to $req_ver"
	fi
}

build() {
	local f; for f in ./*.zsh-theme internal/*.zsh; do
		zsh -c "zcompile -R -- $f.zwc $f"
	done
}

package() {
	local destdir="$pkgdir/usr/share/zsh/plugins/powerlevel10k"

	# powerlevel10k.plugin.zsh is mainly for the plugin loader in Alpine's
	# default /etc/zsh/zshrc.
	install -D -m644 -t "$destdir"/ \
		./*.zsh-theme \
		./*_setup \
		"$srcdir"/powerlevel10k.plugin.zsh
	cp -r config internal "$destdir"/

	ln -s ../gitstatus "$destdir"/gitstatus
}

sha512sums="
18c7201ac1c0d31beb166c29a5592316a439891fe26dcb3d0d4bea6fc3f02bdfe4430be59b5888a53075ea152f21d5a7bce6dcf343110596f90127f2268af36e  zsh-theme-powerlevel10k-1.16.1.tar.gz
d437f97eb9ce413aa92293f678a92bf95cb966a1ac611982c15e3fd4c259d32952b70ce630fbce4d5a2b253f4535ead8585b481a25901fcb73f2a952100ba491  powerlevel10k.plugin.zsh
"
